require("../../assets/css/normalize.css");
require("../../assets/css/reset.css");
require("../../assets/fonts/iconfont.css");

require("./sports_course_detail.less");
const axios = require("axios");
const dom = require("../../utils/dom");
document.addEventListener("DOMContentLoaded", function () {
	let id = this.location.search.split("=").pop();
	dom.get("#bank").addEventListener("click", function () {
		history.back();
	});
	axios
		.get("http://fitness.h5.itsource.cn:3701/api/train/courseDetail?id=" + id)
		.then((res) => {
			dom.get("#title").textContent = res.data.data.name;
			dom.get("#title2").textContent = res.data.data.desc;
			dom.get("#img").src =
				"http://fitness.h5.itsource.cn:3701" + res.data.data.imgurl;

			console.log(res);
			let data = res.data.data.fragments;

			localStorage.setItem("fragments", JSON.stringify(data));
		});
});
